package com.beiming.libra.service.impl;


import com.beiming.libra.common.enums.StatusEnum;
import com.beiming.libra.common.utils.CommonsUtils;
import com.beiming.libra.dao.ArbitrationCaseProofFileMapper;
import com.beiming.libra.domain.ArbitrationCaseProofFile;
import com.beiming.libra.service.ArbitrationCaseProofFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author zhengyu
 * @title
 * @create_time 2018/6/6
 */
@Service
public class ArbitrationCaseProofFileServiceImpl implements ArbitrationCaseProofFileService {
  @Autowired
  private ArbitrationCaseProofFileMapper arbitrationCaseProofFileMapper;

  /**
   * 获取举证质证附件关系表服务
   *
   * @param proofId 举证质证表id
   */
  @Override public List<ArbitrationCaseProofFile> listArbitrationCaseProofFiles(String proofId) {
    ArbitrationCaseProofFile params = new ArbitrationCaseProofFile();
    params.setProofId(proofId);
    params.setStatus(StatusEnum.USED.getCode());
    return arbitrationCaseProofFileMapper.select(params);
  }

  /**
   * 批量保存举证质证附件关系表信息
   *
   * @param files   附件信息
   * @param proofId 举证质证表id
   */
  @Override public int saveArbitrationCaseProofFiles(List<MultipartFile> files, String proofId) {
    return 1;
  }

  @Override
  public int saveArbitrationCaseProofFile(ArbitrationCaseProofFile arbitrationCaseProofFile) {
    arbitrationCaseProofFile.setId(CommonsUtils.get32BitUUID());
    return arbitrationCaseProofFileMapper.insert(arbitrationCaseProofFile);
  }
}
